"""
在一个无序数组里有99个不重复的正整数，范围是1～100，唯独缺少1个1～100中的整数。如何找出这个缺失的整数？

"""


def func(li):
    hashli = range(1, 11)
    for i in hashli:
        if i not in li:
            return i
    else:
        return


def func2(li):
    for i in range(len(li) - 1):
        for j in range(len(li) - i - 1):
            if li[j] > li[j + 1]:
                li[j], li[j + 1] = li[j + 1], li[j]
    for i in range(len(li) - 1):
        if li[i + 1] - li[i] != 1:
            return li[i] + 1


def func3(li):
    # snum = sum(range(1, 11))
    snum = (1 + 10) / 2 * 10
    for i in li:
        snum = snum - i
    return snum


print(func([1, 2, 3, 4, 5, 6, 7, 8, 10]))
print(func2([1, 2, 3, 4, 5, 6, 7, 8, 10]))
print(func3([1, 2, 3, 4, 5, 6, 7, 8, 10]))
print(sum(range(1, 11)))
print(int((1 + 10) / 2 * 10))

